﻿@inject IStringLocalizer<BootstrapBlazor.Shared.Samples.Menus> Localizer

<Menu Items="@DisabledMenuItems" DisableNavigation="true" OnClick="@OnClick2" />
<p class="mt-3"><b>@Localizer["MenusPartDisableDescription2"]</b></p>
<div style="width:220px; border-right: 1px solid #e6e6e6;">
    <Menu Items="@DisabledMenuItems" DisableNavigation="true" IsVertical="true" OnClick="@OnClick2" />
</div>

<BlockLogger @ref="Trace2" class="mt-3" />

@code {
    [NotNull]
    private BlockLogger? Trace2 { get; set; }

    [NotNull]
    private IEnumerable<MenuItem>? DisabledMenuItems { get; set; }

    /// <summary>
    /// OnInitialized 方法
    /// </summary>
    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();

        DisabledMenuItems = await MenusDataGerator.GetDisabledMenuItemsAsync(Localizer);
    }
    private Task OnClick2(MenuItem item)
    {
        Trace2.Log($"菜单点击项: {item.Text}");
        return Task.CompletedTask;
    }
}
